package ru.pb.game.network.engine.client.packets.receivable;

import ru.pb.game.network.engine.client.packets.FromClientToGameServerPacket;
import ru.pb.game.network.engine.client.packets.sendable.PROTOCOL_LOBBY_GET_PLAYERINFO_ACK;
import ru.pb.game.objects.model.players.Player;

/**
 * @author DarkSkeleton
 */
public class PROTOCOL_LOBBY_GET_PLAYERINFO_REQ extends FromClientToGameServerPacket
{

	private int id_p;

	public PROTOCOL_LOBBY_GET_PLAYERINFO_REQ()
	{}

	@Override
	public void readImpl()
	{
		readH();
		id_p = readC(); // TODO: 4 byte?
		// _log.info("Player in lobby number: " + id_p);
	}

	@Override
	public void runImpl()
	{
		Player p = getPlayer();
		if(p != null || getClient() == null)
		{
			sendPacket(new PROTOCOL_LOBBY_GET_PLAYERINFO_ACK(id_p));
		}
	}
}
